# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=postgresql-rum
pkgver=1.3.14
pkgrel=0
pkgdesc="PostgreSQL extension providing access method to work with RUM index"
url="https://github.com/postgrespro/rum"
arch="all"
license="PostgreSQL"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="postgresql-dev"
subpackages="
	$pkgname-bitcode
	$pkgname-dev
	"
source="https://github.com/postgrespro/rum/archive/$pkgver/$pkgname-$pkgver.tar.gz"
builddir="$srcdir/rum-$pkgver"
options="!check"  # tests require running PostgreSQL

build() {
	make USE_PGXS=1
}

package() {
	_pgver=$(pg_config --major-version)
	depends="postgresql$_pgver"

	make USE_PGXS=1 DESTDIR="$pkgdir" install
}

bitcode() {
	_pgver=$(pg_config --major-version)
	pkgdesc="$pkgdesc (bitcode for JIT)"
	depends="$pkgname=$pkgver-r$pkgrel"
	install_if="postgresql$_pgver-jit $pkgname=$pkgver-r$pkgrel"

	amove usr/lib/postgresql*/bitcode
}

sha512sums="
84c6f26e51e002da78ec91f3368295d5cd5ed60c8cc60ee3b389742224276f74407b2f67e41be21a8fe49bc2c197ba931fe4431ecd4ca6a6b94bc3a0625eed3d  postgresql-rum-1.3.14.tar.gz
"
